package util;

import model.user.Staff;

import javax.swing.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test {
    public static void main(String[] args) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        long time = 0;
        try {
            String str = "2002-12-12";
            String pattern = "^\\d{4}-\\d{1,2}-\\d{1,2}";

            Pattern r = Pattern.compile(pattern);
            Matcher m = r.matcher(str);
            if (m.matches()) {
                time = dateFormat.parse(str).getTime();
                System.out.println(time);
                System.out.println(dateFormat.parse(str));
            }
        } catch (ParseException parseException) {
            parseException.printStackTrace();
        }
    }
}
